package com.awspaas.user.apps.cpq.controller;

import java.util.List;

import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class CPQ_GetWeightHtmlWeb {

	public String getWeightHtml(UserContext userContext, String jsgs, String clmc, String clbm) {
		try {
			String sql = "select  a.PARMENTIER_NAME,a.PARMENTIER_NO from  "
					+ "BO_EU_CPQ_MODULE_MSG_PRICE_PARAMETERS  a ,BO_EU_CPQ_PROPERTIES m "
					+ "where  a.BINDID=m.BINDID and m.CLBM=? ";
			List<RowMap> maps = DBSql.getMaps(sql, new Object[] { clbm });
			JSONObject jsonData = new JSONObject();
			jsonData.put("title", clmc + "材料重量计算参数填写单");
			JSONArray jsonArray = new JSONArray();
			if (maps.size() > 0) {
				for (RowMap rowMap : maps) {
					JSONObject json = new JSONObject();
					String name = rowMap.getString("PARMENTIER_NAME");
					String no = rowMap.getString("PARMENTIER_NO");
					json.put("name", name);
					json.put("bh", no);
					json.put("data", "");
					jsonArray.add(json);

				}
			}
			jsonData.put("dataList", jsonArray);
			return jsonData.toJSONString();
		} catch (Exception e) {
			throw e;
		}

	}

}
